package io.terminus.lego.shinda.web.security.enums

/**
 * @author wangmeng
 * @date 2018/4/16
 */
enum class OAuth2UserConvertKeyEnum(val nickNameKey: String, val avatarUrlKey: String) {
    Default("name", "avatar_url"),
    GitHub("name", "avatar_url"),
    Google("name", "avatar_url"),
    WeiBo("name", "profile_image_url"),
    qq("nickname", "figureurl_qq_1");

    companion object {
        private val map = OAuth2UserConvertKeyEnum.values().map { it -> it.name.toUpperCase() to it }.toMap()
        fun getByProviderId(providerId: String): OAuth2UserConvertKeyEnum = map[providerId.toUpperCase()] ?: Default
    }
}
